package com.test.pages;

import com.test.base.InitAppium;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

/**
 * Created by xuedonglei on 2017/4/28.
 */
public class LoginPage extends InitAppium{

    // 邮箱地址
    @FindBy(id = "editPhone")
    @CacheLookup
    public WebElement userName;
    // 密码
    @FindBy(id = "editPsd")
    @CacheLookup
    public WebElement pwd;
    // 登录
    @FindBy(id = "login_btn_login")
    @CacheLookup
    public WebElement login;
    // 重置密码
    @FindBy(id = "forgot_pwd")
    @CacheLookup
    public WebElement resetPwd;

    public LoginPage(){
        PageFactory.initElements(new AppiumFieldDecorator(driver),this);
    }

    public void clickButton(WebElement element){
        element.click();
    }

    public void inputKey(WebElement element,String text){
        element.clear();
        element.sendKeys(text);
        driver.hideKeyboard();
    }

}
